import React, { Component } from 'react'

// 类组件接收数据
export default class Child extends Component {
  // #2 子组件通过 this.props （类组件）接收
  handleClick = () => {
    // this.props.salary = 15
    this.props.obj.age = 88
  }
  render() {
    const { salary, age, changeAge } = this.props
    return (
      <div>
        <p>工资：{salary}</p>
        <p>年龄：{age}</p>
        <p>年龄：{this.props.obj.age}</p>
        <p>简单数据类型：{this.props.num}</p>
        <p>布尔：{this.props.bBar}</p>
        <div>JSX: {this.props.jsxEle}</div>
        <button onClick={this.handleClick}>click</button>
        <button onClick={changeAge}>调用父亲的函数</button>
      </div>
    )
  }
}
